<?php
/**
 * Created by PhpStorm.
 * Project: Parser Exist
 * File:    run.php
 * Date:    18.07.13
 * Time:    9:59
 * User:    azzaro.max@gmail.com
 */
$proxy_file = fopen('proxy.txt', 'r');

$db = new mysqli('localhost', 'root', 'root', 'parser_exist');

while (!feof($proxy_file))
{
    $line = explode(':', trim(fgets($proxy_file, 100)));

    $ip = $line[0];
    $port = $line[1];

    $sql = "INSERT INTO `proxy` (`ip`, `port`) VALUES ('$ip', '$port')";
    $db->query($sql);
    print $ip . "\n";
}